package com.hjl.web.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 外部转发类
 * @author Lenovo
 * @date 2021/10/8 11:16
 * @version 1.0
 */
@WebServlet("/out/*")
public class OutServlet extends BaseServlet{
    String prefix = "/WEB-INF/jsp/";
    String suffix = ".jsp";

    /**
     * 跳转WEB-INF里的jsp
     * @author Lenovo
     * @date 2021/10/8 11:16
     */
    public void main(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher(prefix + "main" + suffix).forward(req, resp);
    }

    public void top(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher(prefix + "top" + suffix).forward(req, resp);
    }

    public void left(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher(prefix + "left" + suffix).forward(req, resp);
    }

    public void right(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher(prefix + "right" + suffix).forward(req, resp);
    }
}
